package com.shuigu.ai.util.page;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.util.Collections;
import java.util.List;

public class OffMp {
    public static <T> ShGuPageResult<T> of(Page<T> p){
        ShGuPageResult<T> dto = new ShGuPageResult<>();
        //3.1.总条数
        dto.setTotal(p.getTotal());
        //3.3.当前页数据
        List<T> records = p.getRecords();
        if(records == null){
            dto.setList(Collections.emptyList());
            return dto;
        }
        dto.setList(records);
        return dto;

    }
}
